# -*- coding: utf-8 -*-
from qa_engine.user import User
from .method import methods


def task_response(task_type, entity_dict, question, user: User):
    """
    响应hub指派的回答任务，也就是对task类的问题分intent处理
    :param task_type: 任务类型
    :param entity_dict:
    :param question:
    :param user:
    :return:
    """
    try:
        answer = methods[task_type](question, user, entity_dict)
    except KeyError:
        raise NotImplementedError('unknown task type %s' % task_type)
    return answer
